import base64
from io import BytesIO
from PIL import Image
import re
with open('./base64.txt', 'r') as f:
    txt = f.read()
txt = re.sub('^data:image/.+;base64,', '', txt)
source = base64.b64decode(txt)
img_data = BytesIO(source)
image = Image.open(img_data)
image.show()
